package com.ww.learn.coroutine.flow

import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.asFlow
import kotlinx.coroutines.flow.transform
import kotlinx.coroutines.runBlocking

suspend fun performRequest2(request: Int): String {
    delay(1000)
    return "response $request"
}

fun main() = runBlocking {
    (1..3).asFlow().transform { request ->
        emit("Making request $request")
        emit(performRequest2(request))
    }.collect { response -> println(response) }
}